package ubcns.lib.customtab;
import android.app.TabActivity;
import android.content.Intent;
import android.widget.LinearLayout;
import android.widget.TabHost.TabSpec;

public class CustomTabActivity extends TabActivity 
{

	public void addTab(TabInfo... tabInfos) 
	{
				
		for (TabInfo tabInfo : tabInfos) 
		{
			TabSpec tabSpec = getTabHost().newTabSpec(tabInfo.getTag());
			switch (tabInfo.getInfoType()) 
			{
				case labelAndIcon:
					tabSpec.setIndicator(tabInfo.getLabel(), tabInfo.getIcon());
					break;
				case labelOnly:
					tabSpec.setIndicator(tabInfo.getLabel());
					break;
				case viewOnly:
					tabSpec.setIndicator(tabInfo.getView());
					break;
			}
			tabSpec.setContent(new Intent(this, tabInfo.getActivityClass()));
			getTabHost().addTab(tabSpec);
		}

	}
	
	public void setsetCurrentTab(int n)
	{
		getTabHost().setCurrentTab(n);
	}
}